#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
//	system("start https://www.lanqiao.cn/problems/3897/learning/");

	int n;
	cin >> n;
	string s;
	cin >> s;

	unordered_map<char, int> cnt;
	for (auto i : s) {
		cnt[i]++;
	}

	if (cnt['0'] + 1 < cnt['1'])
		cout << cnt['0'] + 1;
	else
		cout << cnt['1'];

	return 0;
}
